﻿using System;
using System.Collections;
using System.Data;

internal static class Class9
{
    public static void smethod(DataSet dataSet)
    {
        if (dataSet.Tables.Count > 0)
        {
            DataTable item = dataSet.Tables["DelInfo"];
            DataRow str = null;
            string tableName = "";
            foreach (DataTable table in dataSet.Tables)
            {
                tableName = table.TableName;
                if (tableName.Equals("DelInfo"))
                {
                    continue;
                }
                foreach (DataRow row in table.Rows)
                {
                    DataRowState rowState = row.RowState;
                    if (rowState == DataRowState.Added)
                    {
                        row["UpdateStatus"] = 1;
                        row["UpdateTime"] = DateTime.Now;
                    }
                    else if (rowState == DataRowState.Deleted)
                    {
                        str = item.NewRow();
                        str["id"] = Guid.NewGuid().ToString();
                        str["RecId"] = row["id", DataRowVersion.Original];
                        str["TableName"] = tableName;
                        str["IsTrans"] = 1;
                        str["UpdateTime"] = DateTime.Now;
                        str.EndEdit();
                        item.Rows.Add(str);
                    }
                    else if (rowState == DataRowState.Modified)
                    {
                        row["UpdateStatus"] = 2;
                        row["UpdateTime"] = DateTime.Now;
                    }
                }
            }
        }
    }
}